package lec13dp2;

public class J {
    public static void main(String[] args) {
        int[] a = new int[]{
                1, 2, 2, 3, 3, 3, 4, 5, 5, 6
        };
        int n = a.length;
        int[] dp = new int[n];//dp[x] 以a[x]结尾的字序列中a[x]连续出现的次数
        dp[0] = 1;
        for (int i = 1; i < n; i++) {
            if (a[i] != a[i - 1]) dp[i] = 1;
            else dp[i] = dp[i - 1] + 1;
        }
        int max = dp[0];
        for (int i = 1; i < n; i++) {
            max = Math.max(dp[i], max);
        }
        System.out.println(max);
    }
}
